<template>
  <van-nav-bar
    title="选床位"
    left-arrow
    @click-left="$router.push('/reg')"
  ></van-nav-bar>
  <van-tabs sticky>
    <van-tab :title="item.name" v-for="item in typeArr" :key="item.id">
      <hostelItem :id="item.id"></hostelItem>
    </van-tab>
  </van-tabs>
</template>

<script setup>
import { flat } from '@/api'
import { onMounted, ref } from 'vue'
import hostelItem from './components/hostelItem.vue'
const typeArr = ref([])
onMounted(async () => {
  const res = await flat()
  console.log('床位', res)
  typeArr.value = res.result.data
})
</script>

<style></style>
